﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApp_core
{
    public class ReferenClass
    {
        public void Show()
        {
            var referen3 = new Referen3() { id = 3 };//id=3

            Referen1 referen1 = new Referen1() { referen3= referen3 };//id=3


            Referen2 referen2 = new Referen2() { referen3 = referen1.referen3 };//id=3
            referen2.referen3.id = 2;//referen1、referen2，referen3的id都等于2 说明引用类型，使用的是同一个地址。

        }
    }
    class Referen1
    {
        public Referen3 referen3 { get; set; }
    }
    class Referen2
    {
        public Referen3 referen3 { get; set; }

    }
    class Referen3
    {
        public int id { get; set; }
    }
}
